<template>
  <div class="management">
    <div class="management-wrapper">
      <div class="title">
        <div class="titlename">
          GMALL - 店铺管理
        </div>
        <div class="navmemu">
          <el-menu router :default-active="activeIndex" class="el-menu-demo" mode="horizontal">
            <el-menu-item index="guidelist">
              接待详情
            </el-menu-item>
            <el-menu-item index="guideinfo" v-show="hasGuideInfo">
              导购信息
            </el-menu-item>
          </el-menu>
        </div>
      </div>
      <!-- 嵌套子路由 -->
      <ai-main>
        <router-view></router-view>
      </ai-main>
    </div>
  </div>
</template>

<script>
import { Row, Col, DatePicker, Select, Option, Menu, MenuItem } from 'element-ui'
import ICountUp from 'vue-countup-v2'
import Panel from '@/components/panel.vue'
import Main from '@/components/main.vue'
import Moment from 'moment'
import { mapGetters } from 'vuex'

export default {
  name: 'management',

  data () {
    return {
      activeIndex: 'guidelist',
      currDate: Moment().format('YYYY-MM-DD'),
      minutes: 0,
      seconds: 0
    }
  },
  components: {
    elRow: Row,
    elCol: Col,
    elSelect: Select,
    elOption: Option,
    elDatePicker: DatePicker,
    elMenu: Menu,
    elMenuItem: MenuItem,
    // 自定义组件
    countUp: ICountUp,
    aiPanel: Panel,
    aiMain: Main
  },
  created () {
    this.activeIndex = this.$route.name
  },
  computed: {
    ...mapGetters([
      'userinfo'
    ]),
    hasGuideInfo () {
      return !(this.userinfo.role_names && this.userinfo.role_names[0].rank === 2)
    }
  },
  watch: {
    '$route': function () {
      this.activeIndex = this.$route.name
    }
  }
}
</script>

<style scoped lang="less" rel="stylesheet/less">
  .management {
    .management-wrapper {
      .title{
        padding: 10px 0px 0px 20px;
        border-bottom: 1px solid #DDD;
        background-color: #FFF;
        .titlename{
          height:30px;
          line-height: 30px;
          font-size: 16px;
          font-weight: 700;
        }
        .navmemu{
          .el-menu{
            border-bottom:none;
          }
      }
    }
      .managementContent{
      }
    }
}
</style>
